<template>
	<view>
		<view @click="jumpnew(item.title, item.image)" class="news" v-for="(item, i) in newsList" :key="i">
			<view class="news_left"><image :src="item.image"></image></view>
			<text class="news_right">{{ item.title }}</text>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			newsList: []
		};
	},

	onLoad() {
		this.newsLists();
		
	
	},

	// 下拉刷新
	// onPullDownRefresh() {

	// 	setTimeout(() => {
	// 		uni.stopPullDownRefresh();
	// 	}, 1000);
	// },

	methods: {
		async newsLists() {
			const res = await this.$myRequest({
				url: 'https://api.apiopen.top/getWangYiNews',
				method: 'POST',
				data: { page: 1, count: 5 }
			});
			console.log(res, 'ressssaaasdsadqaa');
			this.newsList = res.data.result;
		},
		// jumpnew(title, image) {
		// 	uni.navigateTo({
		// 		url: `../news_all/news_all?id=` + title + '&img=' + image
		// 	});
		// },
		jumpnew() {
			uni.navigateTo({
				url: `../cp/cp`
			});
		}
	}
};
</script>

<style lang="less">
.icon {
	width: 1em;
	height: 1em;
	vertical-align: -0.15em;
	fill: currentColor;
	overflow: hidden;
}
.swiperphotos {
	width: 750rpx;
	height: 375rpx;
}
.navigter {
	display: flex;
	margin-top: 20rpx;

	.nav-item {
		width: 25%;
		text-align: center;

		.icon-shoucang {
			color: #f85f69;
		}
		.icon-lipin {
			color: #f33b3d;
		}
		.icon-tupian {
			color: #ffac3e;
		}
		.icon-paizhao {
			color: #a5adf6;
		}
	}
}
.font_weight {
	font-size: 30rpx;
}

.iconfont {
	font-size: 45rpx;
	// color: #2894ff;
}
.news {
	display: flex;
	margin-top: 10rpx;
	.news_left {
		width: 40%;
		display: flex;
		justify-content: center;
		align-items: center;
		// background-color: pink;
		height: 150rpx;
		image {
			border-radius: 10rpx;
			margin: auto;
			width: 80%;
			height: 80%;
		}
	}
	.news_right {
		margin-top: 30rpx;
		padding-left: 20rpx;
		padding-right: 20rpx;
		width: 60%;
		display: -webkit-box; /*弹性伸缩盒子模型显示*/
		-webkit-box-orient: vertical; /*排列方式*/
		-webkit-line-clamp: 2; /*显示文本行数(这里控制多少行隐藏)*/
		overflow: hidden; /*溢出隐藏*/
		// background-color: pink;
		// height: 80rpx;
	}
}
</style>
